package com.qf.java2201.securitydemo1.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @date 2022/5/16
 * @desc
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/admin")
    public String testAuthority(){

        return "admin的权限";
    }

    @RequestMapping("/role")
    @Secured("ROLE_管理员")
    public String roleAnnoTest(){

        return "角色注解测试";
    }

    @RequestMapping("/permission")
    @PreAuthorize("hasAuthority('menu:system')")
    public String permissionAnnoTest(){
        return "权限注解测试";
    }



}
